// EventLogSource.h

#pragma once

using namespace System;
using namespace System::IO;
using namespace Microsoft::SqlServer::Dts::Pipeline;
using namespace Microsoft::SqlServer::Dts::Pipeline::Wrapper;
using namespace Microsoft::SqlServer::Dts::Runtime::Wrapper;

namespace Microsoft { namespace Samples { namespace SqlServer { namespace SSIS { namespace EventLogSource {

	[DtsPipelineComponent(DisplayName = "Eventlog Source", 
		IconResource = "app.ico",
		Description = "Imports Windows Event logs", 
		ComponentType = ComponentType::SourceAdapter)]
	public ref class EventLogSource : PipelineComponent
	{
	private:
		static String^ inputFilePropertyLabel = "Input EventLog File";
		static String^ inputFileTypeLabel = "EventLog File Type";
		String^ GetVariableName(String^ qualifiedVariableName);
		String^ GetVariableValue(String^ qualifiedVariableName);
		bool VariableExists(String^ variableName);
		String^ GetInputFileName() {
			return this->ComponentMetaData->CustomPropertyCollection[EventLogSource::inputFilePropertyLabel]->Value->ToString();
		}
		String^ GetLogType() {
			return this->ComponentMetaData->CustomPropertyCollection[EventLogSource::inputFileTypeLabel]->Value->ToString();
		}

	public:
		EventLogSource() { }
		virtual void ProvideComponentProperties() override;
		virtual void PrimeOutput(int outputs, array<int>^ outputIDs, array<PipelineBuffer^>^ buffers) override;
		//virtual void ReinitializeMetaData() override;
		virtual DTSValidationStatus Validate() override;
	};
} } } } }
